﻿<form id="myFormId" target="frmright">
    <div class="box1" panelWidth="835">
        <table>
            <tr>
                <td>盘点类型</td>
                <td>
                    <select prompt="请选择" name="orderType" id="orderType" url="/wms/CycleCountManage/GetCheckStockType" selectedValue="@ViewData["orderType"]">
                    </select><span class="star">*</span>
                </td>
                <td>是否明盘</td>
                <td>
                    <select prompt="请选择" name="isObvious" id="isObvious" data='{"list":[{"value":"1","key":"是"},{"value":"0","key":"否"}]}' selectedValue="@ViewData["isObvious"]">
                    </select><span class="star">*</span>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>仓库</td>
                <td>
                    <div class="selectTree" url="/wms/CycleCountManage/getMultiWarehouse" selectedValue="@ViewData["warehouseId"]" name="warehouseId" id="warehouseId" multiMode="true" noGroup="true"></div>
                </td>
                <td>库存地</td>
                <td>
                    <div class="selectTree" url="/wms/CycleCountManage/getMultiErpwarehouse" selectedValue="@ViewData["erpWarehouse"]" name="erpWarehouse" id="erpWarehouse" multiMode="true" noGroup="true"></div>
                </td>
                <td>
                    <input type="button" onclick="screenSearch()" value="筛选" />
                </td>
            </tr>
        </table>
    </div>

    <div class="box1" panelWidth="835">
        <table>
            <tr>
                <td><input type="text" name="zoneName" id="zoneName" /><button type="button" onclick="searcZoneNamehHandler()"><span class="icon_find">查询</span></button></td>
            </tr>
            <tr>
                <td id="leftCon"><div id="maingrid_ZoneLeft"></div></td>
                <td>
                    <input type="button" value="选择选中行>>" onclick="selectAllZone()" />
                    <div class="height_15"></div>
                    <input type="button" value="<<返回选中行" onclick="deSelectAllZone()" />
                </td>
                <td id="rightCon"><div id="maingrid_ZoneRight"></div></td>
            </tr>
        </table>
    </div>

    <div class="box1" panelWidth="835">
        <table>
            <tr>
                <td><input type="text" name="locateName" id="locateName" /><button type="button" onclick="searcLocateNamehHandler()"><span class="icon_find">查询</span></button></td>
            </tr>
            <tr>
                <td id="leftCon"><div id="maingrid_LocateLeft"></div></td>
                <td>
                    <input type="button" value="选择选中行>>" onclick="selectAllLocate()" />
                    <div class="height_15"></div>
                    <input type="button" value="<<返回选中行" onclick="deSelectAllLocate()" />
                </td>
                <td id="rightCon"><div id="maingrid_LocateRight"></div></td>
            </tr>
        </table>

    </div>
    <div class="box1" panelWidth="835">
        <table>
            <tr>
                <td><input type="text" name="partNo" id="partNo" /><button type="button" onclick="searchPartNoHandler()"><span class="icon_find">查询</span></button><input type="checkbox" name="cb_PartNo" id="cb_PartNo" checked="checked" value="关联库区" onclick="cbPartNoChange();" /><label for="cb_PartNo" class="hand">关联库区</label></td>
            </tr>
            <tr>
                <td id="leftCon"><div id="maingrid_PartLeft"></div></td>
                <td>
                    <input type="button" value="选择选中行>>" onclick="selectAllPartNo()" />
                    <div class="height_15"></div>
                    <input type="button" value="<<返回选中行" onclick="deSelectAllPartNo()" />
                </td>
                <td id="rightCon"><div id="maingrid_PartRight"></div></td>
            </tr>
        </table>
    </div>
    <div style="text-align:center;">
        <input type="submit" value="提交" style="width:120px;height:35px;" onclick="return add()" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" value="取消" style="width:120px;height:35px;" onclick="top.Dialog.close()" />
    </div>
</form>


<script type="text/javascript">
    //数据表格使用
    var grid_PartLeft; var grid_PartRight; var grid_ZoneLeft; var grid_ZoneRight; var grid_LocateLeft; var grid_LocateRight; var indexVal = 0;
    function initComplete() {
        grid_PartLeft = $("#maingrid_PartLeft").quiGrid({
            columns: [
                { display: '零件号代码', name: 'partNo', align: 'center', width: "60%", isSort: false },
                { display: '零件号名称', name: 'partSpec', align: 'center', width: "40%", isSort: false },
                {
                    display: '选择', isAllowHide: false, align: 'center', width: 50, isSort: false,
                    render: function(rowdata, rowindex, value, column) {
                        return '<div class="padding_top4 padding_left5">'
                            + '<span class="img_btn_right hand" title="选择" onclick="selectItemPartNo(' + rowdata.partId + ',' + rowindex + ')"></span>'
                            + '</div>';
                    }
                }
            ], data: [], pageSize: 10, rownumbers: true, checkbox: true, percentWidthMode: true, sortName: "partNo", sortOrder: "desc",
            height: '400', width: "350", showPageInfo: false, showPageSize: false, title: "未选择列表"
        });
        //$.post("/wms/CycleCountManage/GetPartByPage",
        //    //获取所有选中行
        //    { partNo: $("#partNo").val() },
        //    function(result) {
        //        //页号重置为1
        //        grid_PartLeft.setNewPage(1);
        //        grid_PartLeft.loadData(result);
        //    },
        //    "json");

        grid_PartRight = $("#maingrid_PartRight").quiGrid({
            columns: [
                { display: '零件号代码', name: 'partNo', align: 'center', width: "60%", isSort: false },
                { display: '零件号名称', name: 'partSpec', align: 'center', width: "40%", isSort: false },
                {
                    display: '删除', isAllowHide: false, align: 'center', width: 50, isSort: false,
                    render: function(rowdata, rowindex, value, column) {
                        return '<div class="padding_top4 padding_left5">'
                            + '<span class="img_delete hand" title="删除" onclick="deSelectItemPartNo(' + rowdata.partId + ',' + rowindex + ')"></span>'
                            + '</div>';
                    }
                }
            ], data: [], pageSize: 10, rownumbers: true, checkbox: true, percentWidthMode: true, sortName: "partNo", sortOrder: "desc",
            height: '400', width: "350", showPageInfo: false, showPageSize: false, title: "已选择列表", usePager: false
        });

        grid_ZoneLeft = $("#maingrid_ZoneLeft").quiGrid({
            columns: [
                { display: '库区代码', name: 'zoneName', align: 'center', width: "60%", isSort: false },
                { display: '库区名称', name: 'zoneDesc', align: 'center', width: "40%", isSort: false },
                {
                    display: '选择', isAllowHide: false, align: 'center', width: 50, isSort: false,
                    render: function(rowdata, rowindex, value, column) {
                        return '<div class="padding_top4 padding_left5">'
                            + '<span class="img_btn_right hand" title="选择" onclick="selectZoneItem(' + rowdata.zoneId + ',' + rowindex + ')"></span>'
                            + '</div>';
                    }
                }
            ], data: [], pageSize: 10, rownumbers: true, checkbox: true, percentWidthMode: true, sortName: "zoneName", sortOrder: "desc",
            height: '400', width: "350", showPageInfo: false, showPageSize: false, title: "未选择列表"
        });
        $.post("/wms/CycleCountManage/GetZoneByPage",
            //获取所有选中行
            { warehouseId: $("#warehouseId").attr("relValue"), erpWarehouse: $("#erpWarehouse").attr("relValue"), zoneName: $("#zoneName").val() },
            function(result) {
                //页号重置为1
                grid_ZoneLeft.setNewPage(1);
                grid_ZoneLeft.loadData(result);
            },
            "json");

        grid_ZoneRight = $("#maingrid_ZoneRight").quiGrid({
            columns: [
                { display: '库区代码', name: 'zoneName', align: 'center', width: "60%", isSort: false },
                { display: '库区名称', name: 'zoneDesc', align: 'center', width: "40%", isSort: false },
                {
                    display: '删除', isAllowHide: false, align: 'center', width: 50, isSort: false,
                    render: function(rowdata, rowindex, value, column) {
                        return '<div class="padding_top4 padding_left5">'
                            + '<span class="img_delete hand" title="删除" onclick="delSelectZoneItem(' + rowdata.zoneId + ',' + rowindex + ')"></span>'
                            + '</div>';
                    }
                }
            ], data: [], pageSize: 10, rownumbers: true, checkbox: true, percentWidthMode: true, sortName: "zoneName", sortOrder: "desc",
            height: '400', width: "350", showPageInfo: false, showPageSize: false, title: "已选择列表", usePager: false
        });

        grid_LocateLeft = $("#maingrid_LocateLeft").quiGrid({
            columns: [
                { display: '库位代码', name: 'locateName', align: 'center', width: "60%", isSort: false },
                { display: '库位名称', name: 'locateDesc', align: 'center', width: "40%", isSort: false },
                {
                    display: '选择', isAllowHide: false, align: 'center', width: 50, isSort: false,
                    render: function(rowdata, rowindex, value, column) {
                        return '<div class="padding_top4 padding_left5">'
                            + '<span class="img_btn_right hand" title="选择" onclick="selectLocateItem(' + rowdata.locateId + ',' + rowindex + ')"></span>'
                            + '</div>';
                    }
                }
            ], data: [], pageSize: 10, rownumbers: true, checkbox: true, percentWidthMode: true, sortName: "zoneName", sortOrder: "desc",
            height: '400', width: "350", showPageInfo: false, showPageSize: false, title: "未选择列表"
        });

        $.post("/wms/CycleCountManage/GetLocateByPage",
            //获取所有选中行
            { warehouseId: $("#warehouseId").attr("relValue"), erpWarehouse: $("#erpWarehouse").attr("relValue"), locateName: $("#locateName").val() },
            function(result) {
                //页号重置为1
                grid_LocateLeft.setNewPage(1);
                grid_LocateLeft.loadData(result);
            },
            "json");

        grid_LocateRight = $("#maingrid_LocateRight").quiGrid({
            columns: [
                { display: '库位代码', name: 'locateName', align: 'center', width: "60%", isSort: false },
                { display: '库位名称', name: 'locateDesc', align: 'center', width: "40%", isSort: false },
                {
                    display: '删除', isAllowHide: false, align: 'center', width: 50, isSort: false,
                    render: function(rowdata, rowindex, value, column) {
                        return '<div class="padding_top4 padding_left5">'
                            + '<span class="img_delete hand" title="删除" onclick="delSelectLocateItem(' + rowdata.locateId + ',' + rowindex + ')"></span>'
                            + '</div>';
                    }
                }
            ], data: [], pageSize: 10, rownumbers: true, checkbox: true, percentWidthMode: true, sortName: "zoneName", sortOrder: "desc",
            height: '400', width: "350", showPageInfo: false, showPageSize: false, title: "已选择列表", usePager: false
        });


        //表单提交
        $('#myFormId').submit(function() {

            $.post("/wms/CycleCountManage/saveCycleCountManage",
                {
                    "orderType": $("#orderType").val(), "isObvious": $("#isObvious").val(),
                    "warehouseId": $("#warehouseId").attr("relValue"), "erpWarehouse": $("#erpWarehouse").attr("relValue"),
                    "partNoDetailRow": JSON.stringify(grid_PartRight.rows), "zoneNameDetailRow": JSON.stringify(grid_ZoneRight.rows),
                    "locateNameDetailRow": JSON.stringify(grid_LocateRight.rows),
                },
                function(result) {
                    top.Dialog.alert(result.message, function() {
                        closeWin();
                    })
                });

            return false;
        });

        cbPartNoChange();//加载获取零件号
    }

    function cbPartNoChange() {
        var zoneIds = "";
        for (let i = 0, len = grid_ZoneRight.rows.length; i < len; i++) {
            zoneIds += grid_ZoneRight.rows[i].zoneId + ",";
        }

        var locateIds = "";
        for (let i = 0, len = grid_LocateRight.rows.length; i < len; i++) {
            locateIds += grid_LocateRight.rows[i].locateId + ",";
        }

        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            //零件号筛选
            $.post("/wms/CycleCountManage/getPartNoByZoneIdsOrLocateIds",
                //获取所有选中行
                { zoneIds: zoneIds, locateIds: locateIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        } else {
            //零件号筛选
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }


    function add() {
        var orderType = $("#orderType").val();
        if (orderType == "" || orderType == null) {
            alert("请选择盘点单据类型！");
            return false;
        }

        var isObvious = $("#isObvious").val();
        if (isObvious == "" || isObvious == null) {
            alert("请选择是否明盘！");
            return false;
        }

        var g2rowNum = grid_PartRight.getData().length;
        var g4rowNum = grid_ZoneRight.getData().length;
        var g6rowNum = grid_LocateRight.getData().length;
        if (g4rowNum == 0 && g6rowNum == 0 && g2rowNum == 0) {
            alert("请选择库区或库位或零件号！");
            return false;
        }

        return true;
    }

    function selectItemPartNo(rowid, rowindex) {
        debugger
        var rowData = grid_PartLeft.getRow(rowindex);
        selectPartNoHandler(rowData, rowid, rowindex)
    }

    function deSelectItemPartNo(rowid, rowindex) {
        debugger
        var rowData = grid_PartRight.getRow(rowindex);
        deSelectPartNoHandler(rowData, rowid)
    }

    var selList = [];

    function selectPartNoHandler(rowData, rowid) {
        let gridArr = grid_PartRight.rows;
        for (let i = 0, len = gridArr.length; i < len; i++) {
            if (gridArr[i].partNo == rowData.partNo)//判断存在不添加
            {
                return;
            }
        }

        selList.push({
            index: indexVal,
            partId: rowData.partId,
            partNo: rowData.partNo,
            partSpec: rowData.partSpec,
        });

        var selInList = [];
        selInList.push({
            rows: selList
        })

        grid_PartRight.loadData(selInList[0]);

        indexVal++;
    }

    function deSelectPartNoHandler(rowData, rowid) {
        grid_PartRight.deleteRow(rowData);
    }

    function selectAllPartNo() {
        var rows = grid_PartLeft.getSelectedRows();
        for (var i = 0; i < rows.length; i++) {
            selectPartNoHandler(rows[i], rows[i].partId);
        }
    }

    function deSelectAllPartNo() {
        var rows = grid_PartRight.getSelectedRows();
        for (var i = 0; i < rows.length; i++) {
            deSelectPartNoHandler(rows[i], rows[i].partId);
        }
    }

    function selectZoneItem(rowid, rowindex) {
        debugger
        var rowData = grid_ZoneLeft.getRow(rowindex);
        selectZoneHandler(rowData, rowid, rowindex)
    }

    function delSelectZoneItem(rowid, rowindex) {
        debugger
        var rowData = grid_ZoneRight.getRow(rowindex);
        deSelectZoneHandler(rowData, rowid)
        var zoneIds = "";
        for (let i = 0, len = grid_ZoneRight.rows.length; i < len; i++) {
            zoneIds += grid_ZoneRight.rows[i].zoneId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByZoneIds",
                //获取所有选中行
                { zoneIds: zoneIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }
    var selList1 = [];
    var selList2 = [];

    function selectZoneHandler(rowData, rowid) {
        let gridArr = grid_ZoneRight.rows;
        for (let i = 0, len = gridArr.length; i < len; i++) {
            if (gridArr[i].zoneName == rowData.zoneName)//判断存在不添加
            {
                return;
            }
        }

        selList1.push({
            index: indexVal,
            zoneId: rowData.zoneId,
            zoneName: rowData.zoneName,
            zoneDesc: rowData.zoneDesc,
        });

        var selInList1 = [];
        selInList1.push({
            rows: selList1
        })

        grid_ZoneRight.loadData(selInList1[0]);

        var zoneIds = "";
        for (let i = 0, len = grid_ZoneRight.rows.length; i < len; i++) {
            zoneIds += grid_ZoneRight.rows[i].zoneId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByZoneIds",
                //获取所有选中行
                { zoneIds: zoneIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }

        selList2 = [];//清空库位
        grid_LocateRight.loadData(selList2);
        indexVal++;
    }

    function deSelectZoneHandler(rowData, rowid) {
        grid_ZoneRight.deleteRow(rowData);
    }

    function selectAllZone() {
        var rows = grid_ZoneLeft.getSelectedRows();
        for (var i = 0; i < rows.length; i++) {
            selectZoneHandler(rows[i], rows[i].zoneId);
        }
        var locateIds = "";
        for (let i = 0, len = grid_LocateRight.rows.length; i < len; i++) {
            locateIds += grid_LocateRight.rows[i].locateId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByLocateIds",
                //获取所有选中行
                { locateIds: locateIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }

    function deSelectAllZone() {
        var rows = grid_ZoneRight.getSelectedRows();
        for (var i = 0; i < rows.length; i++) {
            deSelectZoneHandler(rows[i], rows[i].zoneId);
        }
        var zoneIds = "";
        for (let i = 0, len = grid_ZoneRight.rows.length; i < len; i++) {
            zoneIds += grid_ZoneRight.rows[i].zoneId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByZoneIds",
                //获取所有选中行
                { zoneIds: zoneIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }

    function selectLocateItem(rowid, rowindex) {
        debugger
        var rowData = grid_LocateLeft.getRow(rowindex);
        selectLocateHandler(rowData, rowid, rowindex)
        var locateIds = "";
        for (let i = 0, len = grid_LocateRight.rows.length; i < len; i++) {
            locateIds += grid_LocateRight.rows[i].locateId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByLocateIds",
                //获取所有选中行
                { locateIds: locateIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }

    function delSelectLocateItem(rowid, rowindex) {
        debugger
        var rowData = grid_LocateRight.getRow(rowindex);
        deSelectLocateHandler(rowData, rowid)

        var locateIds = "";
        for (let i = 0, len = grid_LocateRight.rows.length; i < len; i++) {
            locateIds += grid_LocateRight.rows[i].locateId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByLocateIds",
                //获取所有选中行
                { locateIds: locateIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }

    function selectLocateHandler(rowData, rowid) {
        let gridArr = grid_LocateRight.rows;
        for (let i = 0, len = gridArr.length; i < len; i++) {
            if (gridArr[i].locateName == rowData.locateName)//判断存在不添加
            {
                return;
            }
        }
        selList2.push({
            index: indexVal,
            locateId: rowData.locateId,
            locateName: rowData.locateName,
            locateDesc: rowData.locateDesc,
        });

        var selInList2 = [];
        selInList2.push({
            rows: selList2
        })

        grid_LocateRight.loadData(selInList2[0]);

        var locateIds = "";
        for (let i = 0, len = grid_LocateRight.rows.length; i < len; i++) {
            locateIds += grid_LocateRight.rows[i].locateId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByLocateIds",
                //获取所有选中行
                { locateIds: locateIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }

        selList1 = [];//清空库区
        grid_ZoneRight.loadData(selList1);
        indexVal++;
    }

    function deSelectLocateHandler(rowData, rowid) {
        grid_LocateRight.deleteRow(rowData);
    }

    function selectAllLocate() {
        var rows = grid_LocateLeft.getSelectedRows();
        for (var i = 0; i < rows.length; i++) {
            selectLocateHandler(rows[i], rows[i].locateId);
        }
    }

    function deSelectAllLocate() {
        var rows = grid_LocateRight.getSelectedRows();
        for (var i = 0; i < rows.length; i++) {
            deSelectLocateHandler(rows[i], rows[i].locateId);
        }

        var locateIds = "";
        for (let i = 0, len = grid_LocateRight.rows.length; i < len; i++) {
            locateIds += grid_LocateRight.rows[i].locateId + ",";
        }
        var checked = $('#cb_PartNo').attr('checked');
        if (checked) {
            $.post("/wms/CycleCountManage/getPartNoByLocateIds",
                //获取所有选中行
                { locateIds: locateIds },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
        else {
            //获取所有零件号
            $.post("/wms/CycleCountManage/GetPartByPage",
                //获取所有选中行
                { partNo: "" },
                function(result) {
                    //页号重置为1
                    grid_PartLeft.setNewPage(1);
                    grid_PartLeft.loadData(result);
                },
                "json");
        }
    }


    //筛选
    function screenSearch() {
        $.post("/wms/CycleCountManage/GetZoneByPage",
            //获取所有选中行
            { warehouseId: $("#warehouseId").attr("relValue"), erpWarehouse: $("#erpWarehouse").attr("relValue") },
            function(result) {
                grid_ZoneLeft.setNewPage(1);
                grid_ZoneLeft.loadData(result);
            },
            "json");

        $.post("/wms/CycleCountManage/GetLocateByPage",
            //获取所有选中行
            { warehouseId: $("#warehouseId").attr("relValue"), erpWarehouse: $("#erpWarehouse").attr("relValue") },
            function(result) {
                grid_LocateLeft.setNewPage(1);
                grid_LocateLeft.loadData(result);
            },
            "json");
    }


    //零件号筛选
    function searchPartNoHandler() {
        $.post("/wms/CycleCountManage/GetPartByPage",
            //获取所有选中行
            { partNo: $("#partNo").val() },
            function(result) {
                //页号重置为1
                grid_PartLeft.setNewPage(1);
                grid_PartLeft.loadData(result);
            },
            "json");
    }

    //库区筛选
    function searcZoneNamehHandler() {
        $.post("/wms/CycleCountManage/GetZoneByPage",
            //获取所有选中行
            { warehouseId: $("#warehouseId").attr("relValue"), erpWarehouse: $("#erpWarehouse").attr("relValue"), zoneName: $("#zoneName").val() },
            function(result) {
                //页号重置为1
                grid_ZoneLeft.setNewPage(1);
                grid_ZoneLeft.loadData(result);
            },
            "json");
    }

    //库位筛选
    function searcLocateNamehHandler() {
        $.post("/wms/CycleCountManage/GetLocateByPage",
            //获取所有选中行
            { warehouseId: $("#warehouseId").attr("relValue"), erpWarehouse: $("#erpWarehouse").attr("relValue"), locateName: $("#locateName").val() },
            function(result) {
                grid_LocateLeft.setNewPage(1);
                grid_LocateLeft.loadData(result);
            },
            "json");
    }

    //重置
    function closeWin() {
        debugger
        //刷新数据
        var tabfrmId = "page_" + top.frmright.getCurrentTabId();
        top.frmright.document.getElementById(tabfrmId).contentWindow.refresh(false);
        //关闭窗口
        top.Dialog.close();
    }

</script>
